<?php
class Indicadores_Form_Expresionindicador extends Form_Base{
	
	public function __construct($options = null) {
		parent::__construct($options);
	}
	
	public function init() {
		$this->setName('indicador');
		$this->setMethod("post");
		$this->setAttrib('enctype', 'multipart/form-data');
		$domConfig = Zend_Registry::get('domConfig'); //esto se crea en el bootstrap
		
		$array_elements[] = new Zend_Form_Element_Hidden("codindicador");
		
		$element = new Zend_Form_Element_Textarea('expresion');
		$element->setRequired(true);
		$element->addFilter('StripTags');
		$element->addFilter('StringTrim');
		$element->setAttrib("rows",6);
		$element->addValidator('StringLength', false, array($domConfig->TEXTO_TAMANOMIN));
		$array_elements[] = $element;
		
		$element = new Zend_Form_Element_Submit ( 'btnSubmit' );
		$element->setLabel("Guardar");
		$array_elements[] = $element;

		$element = new Zend_Form_Element_Reset ( 'btnReset' );
		$element->setLabel("Resetear expresión");
		$array_elements[] = $element;
		
		$this->addElements ($array_elements);
		
		$this->loadTableDecorators();
		$this->loadViewScriptDecorators();
		$array_elements[2]->setDecorators($this->_buttonDecoratorsOpen);
		$array_elements[3]->setDecorators($this->_buttonDecoratorsClose);
	}
	
    public function loadViewScriptDecorators() {
        $this->setDecorators(array(array('viewScript',array('viewScript'=>'viewscripts/expresionindicador_form.phtml'))));
    }
	
}